<template>
  <section>
    <el-select v-model="grade" placeholder="请选择年级" clearable :disabled="disabled" @change="onchange">
      <el-option v-for="item in items" :key="item.id" :label="item.name" :value="item.id">
      </el-option>
    </el-select>
  </section>
</template>

<script>
import _categories from "@/common/categories";

export default {
  props: {
    value: {
      type: Number | null,
      default: "",
    },
    disabled: {
      type: Boolean,
      default: false,
    },
  },

  watch: {
    value() {
      this.grade = this.value;
    },
  },

  data() {
    return {
      grade: this.value,
      items: _categories.grades,
    };
  },

  methods: {
    getItems() { },
    onchange(value) {
      this.$emit("input", value);
    },
  },
};
</script>

<style></style>